<template>
  <div class="loginWrap">
    <div class="loginForm">
      <img width="100px" src="../../assets/monky.png" alt="">
      <h1>monky_hou</h1>
      <div class="options" @click="login">
        <div class="optionsBtn" :data-type="JSON.stringify(url)" v-for="(url, tag) in homeOptions" :key="url.url">{{ tag
          }}</div>
      </div>
      <div style="text-align: right; width: 300px;">vue3+ts+vite</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';
import { homeOptions } from '@/config/home.ts'
const router = useRouter()
const login = (e: MouseEvent) => {
  const item = JSON.parse((e.target as HTMLElement).dataset.type as string)
  if (item.type == "route") {
    router.push(`/${item.url}`)
  } else {
    location.href = item.url as string
  }
}

</script>

<style lang="scss">
.loginWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: url(../../assets/bg.jpg) no-repeat 0 0;
  height: 100vh;
  background-size: 100% 100%;

}

.loginForm {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30%;
  max-width: 500px;
  height: 150px;
  padding: 10px;

  >* {
    margin: 5px;
  }
}

.options {
  display: flex;

  .optionsBtn {
    margin: 10px;
    max-width: 90px;
    min-width: 70px;
    height: 30px;
    cursor: pointer;
    text-align: center;
    line-height: 30px;
    border-radius: 5px;
    border: 1px solid black;
    background-color: rgba(136, 143, 149, 0.372);

    &:hover {
      background-color: rgba(37, 40, 42, 0.556);
      color: #fff;
    }
  }
}
</style>